#include "InstrumentSettingWidget.h"
#include "ui_InstrumentSettingWidget.h"
#include <configure/DopplerConfigure.h>

InstrumentSettingWidget::InstrumentSettingWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::InstrumentSettingWidget)
{
    ui->setupUi(this);
    m_pConfig = DopplerConfigure::Instance()  ;
    InitCommonConfig();
}

InstrumentSettingWidget::~InstrumentSettingWidget()
{
    delete ui;
}

void InstrumentSettingWidget::InitCommonConfig()
{
    COMMON_CONFIG& config = m_pConfig->common ;
    ui->ComScanType->setCurrentIndex(config.scanner.eScanType);
    ui->ComEncoderType->setCurrentIndex(config.scanner.eEncoderType);
    ui->ValuePrf->setValue(config.scanner.fPrf);
    ui->ValueScanStart->setValue(config.scanner.fScanStart);
    ui->ValueScanEnd->setValue(config.scanner.fScanStop);
    ui->ValueScanResolution->setValue(config.scanner.fScanStep);
    ui->ValueIndexStart->setValue(config.scanner.fIndexStart);
    ui->ValueIndexStop->setValue(config.scanner.fIndexStop);
    ui->ValueIndexResolution->setValue(config.scanner.fIndexStep);

    int _nEncoder = ui->ComEncoderTypeSetting->currentIndex() + 1;
    ui->ValueEncoderResolution->setValue(config.scanner.encoder[_nEncoder].fResulotion);
    ui->ComEncoderPolarity->setCurrentIndex(config.scanner.encoder[_nEncoder].ePolarity);
    ui->ComEncoderDirection->setCurrentIndex(config.scanner.encoder[_nEncoder].eEncoderMode);
    ui->ValueEncoderOrg->setValue(config.scanner.encoder[_nEncoder].fOrigin);

    ui->ComVoltagePa->setCurrentIndex(config.instrument.eVoltagePA);
    ui->ComVoltageUt->setCurrentIndex(config.instrument.eVoltageUT);
    ui->ComTRPA->setCurrentIndex(config.instrument.eTxRxModePA);
    ui->ComTRUT->setCurrentIndex(config.instrument.eTxRxModeUT);
}


void InstrumentSettingWidget::on_ComScanType_currentIndexChanged(int index)
{
    //qDebug("on_ComScanType_currentIndexChanged");
}

void InstrumentSettingWidget::on_ComEncoderType_currentIndexChanged(int index)
{
    //qDebug("on_ComEncoderType_currentIndexChanged");
}

void InstrumentSettingWidget::on_ValuePrf_valueChanged(double arg1)
{
    //qDebug("on_ValuePrf_valueChanged");
}

void InstrumentSettingWidget::on_ValueIndexStop_valueChanged(double arg1)
{
    //qDebug("on_ValueIndexStop_valueChanged");
}


void InstrumentSettingWidget::on_ValueScanStart_valueChanged(double arg1)
{
    //qDebug("on_ValueScanStart_valueChanged");
}

void InstrumentSettingWidget::on_ValueIndexStart_valueChanged(double arg1)
{
    //qDebug("on_ValueIndexStart_valueChanged");
}

void InstrumentSettingWidget::on_ValueScanEnd_valueChanged(double arg1)
{
    //qDebug("on_ValueScanEnd_valueChanged");
}

void InstrumentSettingWidget::on_ValueScanResolution_valueChanged(double arg1)
{
    //qDebug("on_ValueScanResolution_valueChanged");
}

void InstrumentSettingWidget::on_ValueIndexResolution_valueChanged(double arg1)
{
    //qDebug("on_ValueIndexResolution_valueChanged");
}

void InstrumentSettingWidget::on_ComEncoderTypeSetting_currentIndexChanged(int index)
{
    //qDebug("on_ComEncoderTypeSetting_currentIndexChanged");
}

void InstrumentSettingWidget::on_ValueEncoderResolution_valueChanged(double arg1)
{
    //qDebug("on_ValueEncoderResolution_valueChanged");
}

void InstrumentSettingWidget::on_ComEncoderPolarity_currentIndexChanged(int index)
{
    //qDebug("on_ComEncoderPolarity_currentIndexChanged");
}

void InstrumentSettingWidget::on_ComEncoderDirection_currentIndexChanged(int index)
{
    //qDebug("on_ComEncoderDirection_currentIndexChanged");
}

void InstrumentSettingWidget::on_ValueEncoderOrg_valueChanged(double arg1)
{
    //qDebug("on_ValueEncoderOrg_valueChanged");
}

void InstrumentSettingWidget::on_ComVoltagePa_currentIndexChanged(int index)
{
    //qDebug("on_ComVoltagePa_currentIndexChanged");
}

void InstrumentSettingWidget::on_ComVoltageUt_currentIndexChanged(int index)
{
    //qDebug("on_ComVoltageUt_currentIndexChanged");
}

void InstrumentSettingWidget::on_ComTRPA_currentIndexChanged(int index)
{
    //qDebug("on_ComTRPA_currentIndexChanged");
}

void InstrumentSettingWidget::on_ComTRUT_currentIndexChanged(int index)
{
    //qDebug("on_ComTRUT_currentIndexChanged");
}
